package com.xmall.product.define.request.spu;

import com.xmall.define.base.BaseUpdateRequest;
import com.xmall.validate.group.AddGroup;
import com.xmall.validate.group.UpdateGroup;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 请求数据格式：新增/编辑 product - spu
 */
@Data
public class SpuUpdateRequest extends BaseUpdateRequest implements Serializable {

    /**
     * 基本信息
     */
    @Valid
    @NotNull(message = "基本信息不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private SpuInfoRequest info;

    /**
     * 图片
     */
    @Valid
    @NotEmpty(message = "商品至少需要一张图片", groups = { AddGroup.class, UpdateGroup.class })
    private List<SpuImageRequest> images;

    /**
     * 描述
     */
    @Valid
    private List<SpuDescRequest> descs;

    /**
     * 规格参数
     */
    @Valid
    private List<SpuBaseAttrRequest> baseAttrs;

    /**
     * 销售参数
     */
    @Valid
    private List<SpuSaleAttrRequest> saleAttrs;

    /**
     * sku列表
     */
    @Valid
    @NotEmpty(message = "sku列表不能为空", groups = { AddGroup.class, UpdateGroup.class })
    private List<SkuInfoRequest> skuInfos;

}
